class Solution {
public:
    int lengthOfLIS(vector<int>& nums)
    {
        int n = nums.size(), ret = 1;
        vector<int> dp(n, 1);
        for (int i = 0; i < n; i++)
        {
            for (int j = i - 1; j >= 0; j--)
            {
                if (nums[j] < nums[i])dp[i] = max(dp[j] + 1, dp[i]);
            }
            ret = max(ret, dp[i]);
        }
        return ret;
    }
};